package com.es.dao.impl;

import com.es.dao.ICBCAccountDao;
import com.es.entity.ICBCAccount;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;

@Repository
public class ICBCAccountDaoImpl implements ICBCAccountDao {

    @Autowired
    private JdbcTemplate template;

    @Override
    public int createAccount(ICBCAccount icbcAccount) {
        String sql = "insert into icbc_account(name,card_no,balance) values (?,?,?)";
        int result = template.update(sql, icbcAccount.getName(),icbcAccount.getCardNo(),icbcAccount.getBalance());
        int i = 10/0;
        return result;
    }

    @Override
    public int withdraw(String cardNo, BigDecimal mount) {
        return 0;
    }

    @Override
    public int deposit(String cardNo, BigDecimal mount) {
        return 0;
    }
}
